import service from "@/utils/request";

/**
 * 从后端获取账户列表
 */
export async function getAccountList() {
  return await service
    .request({
      method: "get",
      url: "/fund/acc_list"
    })
    .then(res => res.data)
    .catch(err => err);
}
/**
 * 获取基金基础信息
 */
export async function fundBasic(fund = "") {
  return await service
    .request({
      method: "get",
      url: "/fund/fundBasic",
      params: {
        fund
      }
    })
    .then(res => res.data)
    .catch(err => err);
}
/**
 * 基金操作提交后端
 */
export async function tradeFund(form) {
  return await service
    .request({
      method: "post",
      url: "/fund/fund_hold",
      data: form
    })
    .then(res => res.data)
    .catch(error => Promise.reject(error));
}
/**
 * 更新基金净值
 */
export async function spiderInfo(type = "") {
  return await service
    .request({
      method: "get",
      url: "/spider",
      params: {
        type
      }
    })
    .then(res => res.data)
    .catch(err => err);
}
